package com.iqismart.shorturl.vo.base;

import java.io.Serializable;
import java.util.List;

/**
 * @Description
 * @Auther sty
 * @createTime 2019/10/14 02:42
 */
public class PageResponse<T> implements Serializable {
    private List<T> content;
    private int currentPage;
    private int pageSize;
    private int size;
    private int total;
    private int totalPages;

    public PageResponse() {
    }

    public PageResponse(List<T> content, int currentPage, int pageSize, int size, int total) {
        this.content = content;
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.size = size;
        this.total = total;
    }

    public List<T> getContent() {
        return this.content;
    }

    public void setContent(List<T> content) {
        this.content = content;
    }

    public int getCurrentPage() {
        return this.currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return this.total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getTotalPages() {
        return this.pageSize == 0 ? 1 : (int)Math.ceil((double)this.total / (double)this.pageSize);
    }
}